#!/bin/bash

install_agent_ss()
{
    rm -rf /tmp/App_Linux.tar.gz*
    rm -rf /tmp/install_agent.sh*
    wget -P /tmp/ http://56.18.99.206/crbc_software/qingteng/$1/install_agent.sh 
    wget -P /tmp/ http://56.18.99.206/crbc_software/qingteng/App_Linux.tar.gz
    bash /tmp/install_agent.sh offinstall
}

install_agent_zh()
{
    rm -rf /tmp/App_Linux.tar.gz*
    rm -rf /tmp/install_agent.sh*
    wget -P /tmp/ http://10.200.210.187/crbc_software/qingteng/$1/install_agent.sh 
    wget -P /tmp/ http://10.200.210.187/crbc_software/qingteng/App_Linux.tar.gz	
    bash /tmp/install_agent.sh offinstall
}

install_agent_test()
{
    curl -s -L 'http://10.241.26.63/agent/download?k=2b86bfbb85c56bafb5ae60423dd46d8003f1a52f&group=1&protocol=0' | bash
}

delete_file()
{
    rm -rf /tmp/App_Linux.tar.gz*
    rm -rf /tmp/install_agent.sh*
}
uninstall_agent()
{
    bash /titan/agent/install_agent.sh disclean
}

echo "=====agent ip====="
echo "0 : uninstall agent"
echo "1 : 10.198.230.249"
echo "2 : 10.200.212.251"
echo "3 : 10.194.41.249"
echo "4 : 10.194.61.249"
echo "5 : 10.193.33.249"
echo "6 : 10.193.64.249"
echo "7 : 10.0.77.249"
echo "8 : 10.0.97.249"
echo "9 : 30.7.102.249"
echo "10 : 56.16.1.249"
echo "11 : 57.12.1.249"
echo "12 : 58.2.2.249"
echo "13 : 58.6.8.249"
echo "14 : 58.8.16.249"
echo "15 : 58.8.64.249"
echo "16 : 58.20.33.249"
echo "17 : 58.20.96.249"
echo "18 : 10.241.26.63"
read -p "Please input number：" -t 30 cho
case $cho in
    0)
		uninstall_agent
        ;;
    1)
		install_agent_zh 10_198_230_249
		delete_file
        ;;
    2)
		install_agent_zh 10_200_212_251
		delete_file        
        ;;
    3)
		install_agent_zh 10_194_41_249
		delete_file        
        ;;
	4)
		install_agent_zh 10_194_61_249
		delete_file 
        ;;
	5)
		install_agent_zh 10_193_33_249
		delete_file 
        ;;
	6)
		install_agent_zh 10_193_64_249
		delete_file 
        ;;
	7)
		install_agent_zh 10_0_77_249
		delete_file 
        ;;
	8)
		install_agent_zh 10_0_97_249
		delete_file 
        ;;
	9)
		install_agent_zh 30_7_102_249
		delete_file 
        ;;
	
	10)
		install_agent_ss 56_16_1_249
		delete_file 
        ;;

	11)
		install_agent_ss 57_12_1_249
		delete_file 
        ;;
	12)
		install_agent_ss 58_2_2_249
		delete_file 
        ;;
	13)
		install_agent_ss 58_6_8_249
		delete_file 
        ;;
	14)
		install_agent_ss 58_8_16_249
		delete_file 
        ;;
	15)
		install_agent_ss 58_8_64_249
		delete_file 
        ;;
	16)
		install_agent_ss 58_20_33_249
		delete_file 
        ;;
	17)
		install_agent_ss 58_20_96_249
		delete_file 
        ;;
	18)
		install_agent_test
        ;;
	
    *)
        echo "input err"
esac